package com.huihuiyun.huihuiyun;

import com.huihuiyun.huihuiyun.server.Application;
import com.huihuiyun.huihuiyun.server.domain.HhyBook;
import com.huihuiyun.huihuiyun.server.repository.HhyBookRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.PostConstruct;

@SpringBootApplication
public class MyApplication {

    @Autowired
    private HhyBookRepository bookRepository;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @PostConstruct
    public void init() {
        HhyBook book = new HhyBook();
        book.id = "11";
        book.name = "hellobook";
        bookRepository.save(book);
    }
}